//
//  LGStatusViewModel.swift
//  LGWeibo
//
//  Created by 李更 on 8/14/16.
//  Copyright © 2016 itcast. All rights reserved.
//

import UIKit

class LGStatusViewModel: NSObject {
    //创建对象model
    var statusModel : LGStatusModel?
    
    // 微博等级图片
    var mbrankImage: UIImage?
    
    // 微博认证图片
    var verifiedImage: UIImage?
    
    init(statusModel :LGStatusModel ) {
        super.init()
        self.statusModel = statusModel
        mbrankImage = dealMbrankImage(statusModel.user?.mbrank ?? 0)
        verifiedImage = dealVerifiedImage(statusModel.user?.verified ?? -1)
    }
    
   
    
   
}
extension LGStatusViewModel{
    
    func dealMbrankImage(mbank : Int)->UIImage?{
        if mbank > 0 && mbank < 7 {
            return UIImage(named: "common_icon_membership_level\(mbank)")
        }
        return UIImage(named: "common_icon_membership")
        
    }
    //处理微博用户认证image/// 认证类型 -1：没有认证，1，认证用户，2,3,5: 企业认证，220: 达人

    
    func dealVerifiedImage(verified : Int) -> UIImage? {
        switch verified {
        case 1:
           return UIImage(named: "avatar_vip")
        case 2,3,5:
           return UIImage(named: "avatar_enterprise_vip")
        case 220:
           return UIImage(named: "avatar_grassroot")
        default:
            return UIImage(named: "avatar_vgirl")
        }
    }
    
}